<?php 
session_start();
if (isset($_SESSION["email"])){echo "<script language=\"javascript\">location.href=\"index.php\";</script>";}

include("sql.php");
$login=0;
//echo "<br>unset";
if ( isset($_POST['T1']))
{//echo "set"; 
$user=$_POST['T1'];
$inpass=md5($_POST['T2']);
//echo "<br> $inpass <br> ";
$query="select * from login where email=\"$user\" ";
$result=mysql_query($query);

$numrows=mysql_num_rows($result);
		if ( $numrows==0){echo "<script language=\"javascript\">location.href=\"index.php\";</script>";}
if (!mysql_query($query))
  {
  die('Error: ' . mysql_error());
  }
	while($row = mysql_fetch_array($result))
  {
 
 	echo "in loop $row[0] $row[1] $row[2]";
	$pass=$row[1];
 
	if(strcasecmp("$inpass","$pass")==0){ $_SESSION["email"]=$row[4]; $_SESSION["name"]=$row[0];  $_SESSION['aq']=$row['aq']; $login=1;
	echo "<script language=\"javascript\">location.href=\"prob_login.php\";</script>";}
	

	}
}
echo "<script language=\"javascript\">location.href=\"prob_login.php?w=1\";</script>";
?>
